/*
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 *
 * Copyright (c) 2013-2014 sagyf Yang. The Four Group.
 */

package app.events.stat;

import com.github.sog.kit.date.DateProvider;
import com.github.sog.kit.servlet.RequestKit;

import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * .
 * </p>
 *
 * @author sagyf yang
 * @version 1.0 2014-06-08 1:14
 * @since JDK 1.6
 */
public class BrandClickEvent implements Serializable {
    private static final long serialVersionUID = -5531367866038776191L;

    public final long   brand_id;
    public final Date   visit_time;
    public final String visit_ip;
    public final long   member;

    public BrandClickEvent(long brand_id, Date visit_time, String visit_ip, long member) {
        this.brand_id = brand_id;
        this.visit_time = visit_time;
        this.visit_ip = visit_ip;
        this.member = member;
    }

    public static BrandClickEvent create(long brand_id, long member, HttpServletRequest request) {
        return new BrandClickEvent(brand_id,
                DateProvider.DEFAULT.getCurrentDate(),
                RequestKit.getRemoteAddr(request), member);
    }
}
